-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for label/fieldset in serializer #30
base: master
Are you sure you want to change the base?
Add support for label/fieldset in serializer #30
Conversation
@@ -42,6 +42,11 @@ protected function serializeBlock(\DOMElement $parentElement, FormView $view, $b | |||
} | |||
} | |||
|
|||
if ($variables['label']) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CS issue
hum, I have to translate label key if we want the same comportment than Sf2 |
@@ -42,6 +42,11 @@ protected function serializeBlock(\DOMElement $parentElement, FormView $view, $b | |||
} | |||
} | |||
|
|||
if (null === $variables['label']) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the PSR-2 CS.
Are the choice values translated currently ? |
Not, it's label, I have to do |
$parentElement->appendChild($labelElement); | ||
|
||
$labelElement->setAttribute('for', $variables['id']); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
What you do must follow the same logic as in the commented twig. See https://github.com/symfony/symfony/blob/2.1/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig (although it may have been updated a bit since I've written the class) |
Important for easly create a kind of FormView from Form ressource in a SDK (outside of SF2)
render for exemple :